import TauTable from '@/components/TauTable';
import React, { useEffect, useState } from 'react';
import { column, model } from '../stores/definitions';
import { useStore } from '@/hooks';

/**
 *
 * @param {*} param0
 */
function CouponInfoTable({ customerPriceInfos }) {
  const { busOrderStore: store } = useStore();
  const [data, setData] = useState([]);
  const subModel = model.customerPriceInfos[0];

  useEffect(() => {
    setData(customerPriceInfos || []);
  }, []);

  if (data.length === 0) return <></>;

  return (
    <div style={{ margin: '0 0 0 90px' }}>
      <TauTable
        size={'medium'}
        hidePagination
        dataSource={customerPriceInfos}
        primaryKey="id"
        columns={[
          column('fullName', { width: 50 }, subModel),
          column('username', { width: 50 }, subModel),
          column('requestedPrice', { width: 50 }, subModel),
          column('distributionPrice', { width: 50 }, subModel),
          column('consumedPrice', { width: 50 }, subModel),
        ]}
      />
    </div>
  );
}

export default CouponInfoTable;
